package com.wteam.controller;


import com.wteam.PoJo.VO.VoucherVO;
import com.wteam.Service.IVoucherService;
import com.wteam.Service.IVoucherUserService;
import com.wteam.until.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 优惠券表 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-07-16
 */
@RestController
@RequestMapping("/voucher")
@Api(tags = "优惠卷模块")
public class VoucherController {
    @Autowired
    private IVoucherUserService iVoucherUserService;

    @ApiOperation("查看所有优惠卷")
    @GetMapping("/selectvoucher")
    public Result<List<VoucherVO>>selectvoucher() {
        return iVoucherUserService.selectvoucher();
    }

    @GetMapping("/addvoucher/{vocherid}")
    @ApiOperation("用户添加优惠卷")
    public Result addvoucher(@PathVariable @ApiParam("优惠卷id") Long vocherid) {
        return iVoucherUserService.addvoucher(vocherid);
    }

    @GetMapping("/addvoucher")
    @ApiOperation("查看我的优惠卷")
    public Result <List<VoucherVO>>myvocher() {
        return iVoucherUserService.myvocher();
    }
}
